clear 
clear matrix
set mem 500m
set more off
capture log close
dropbox
cd "C:\Users\J. Lawrence Broz\Dropbox\Fed_LLR\stats\swaps"
log using fedswaps_estimation.log, replace

use swaps_071013.dta

**ESTIMATION

**table 8, Probit, dep var is (includes euro area, drops nine eurozone members)
eststo: probit fedswap14 USbankExp2007AmtBil if eurozone!=1, rob
eststo: probit fedswap14 USbankExp2007AmtBil gdpshare LiquidLiabilitiesShare USTradeShare2007 inflation reservesifs if eurozone!=1, rob
eststo: probit fedswap14 USbankExp2007AmtBil gdpshare LiquidLiabilitiesShare USTradeShare2007 inflation reservesifs dollarshortage if eurozone!=1, rob
eststo: probit fedswap14 USbankExp2007AmtBil gdpshare inflation globalfinancialcenter dollarshortage if eurozone !=1, rob
esttab using table8.rtf, replace compress b(3) star(* 0.10 ** 0.05 *** 0.01) se sfmt(a3)label ///
scalars("N Observations" "cmd Model" "r2_p Pseudo R-Squared" "p P-Value" "ll Log Pseudolikelihood" "chi2 Wald Chi-Squared" )

eststo clear
clear
use swaps_071013.dta

**margins and marginsplot using table 8 model 5
probit fedswap14 USbankExp2007AmtBil gdpshare LiquidLiabilitiesShare USTradeShare2007 inflation reservesifs dollarshortage if eurozone!=1, rob
margins, at( USbankExp2007AmtBil =(0(1)41.2))
marginsplot, yline(0) title("Probability of Receiving a Fed Swap Line, by U.S. Bank Exposure")
graph save marginsplot_fedswap_model3.gph, replace
